< previous page page_296 next page >

Page 296
EXERCISE
Set the DataGrid Properties
1. Double-click the (Custom) property to bring up the property pages for the DataGrid control.
2. Click the Columns tab to bring up the dialog box shown in Figure 14.6.
3. Select Column0 from the Column combo box.
4. Assign the Caption property a value of Health Care.
5. Change the DataField property to szHealth_nm.
6. Select Column1 from the Column combo box.
7. Assign the Caption property a value of Waiting Period.
8. Change the DataField property to iWaitingPeriod_amt.
9. Click OK to save the changes.
10. Now run the project. You should see the health care choices appear in the grid.
analysis.gifYou can customize many facets of this grid control, such as the format in which to display data, whether to allow the user to resize the grid at runtime, the ability to add, edit, delete data, and even how the keyboard reacts while the grid has focus.

Displaying the Number of Records
Sometimes you might want to inform the user of how many records are in the table and which record he or she is currently looking at. You can use the Caption property of the data control to display this information. Figure 14.7 shows what this might look like.
Examples Filename: RecCount.frm
Of course, you would not want to do this if you have thousands of records, because it does take a lot of time to get the total number of records from the data control. The reason why it takes so much time is you have to force the Recordset object to go to the last row in the set. This means it has to read every row, and this can take some time on a slow network or if the table has thousands of records. However, if you have a small amount of records, this might be acceptable.

 
< previous page page_296 next page >

If you like this book, buy it!